package com.cta.view.model;

import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.List;

import com.cta.constant.ProfileUserMapping;
import com.cta.entity.Profile;

public class ProfileModel {

	public static final String DATE_FORMAT_COLUMN = "dateformat";
	public static final String TIME_FORMAT_COLUMN = "timeformat";
	public static final String DURATION_FORMAT_COLUMN = "durationformat";

	private List<Profile> mapProfiles = new ArrayList<Profile>();

	private SimpleDateFormat dateFormat = new SimpleDateFormat("dd/MM/yy");
	private SimpleDateFormat timeFormat = new SimpleDateFormat("HHmmss");
	private SimpleDateFormat durationFormat = new SimpleDateFormat("Hmmss");
	
	public List<Profile> getMapProfiles() {
		return mapProfiles;
	}

	public void setMapProfiles(List<Profile> mapProfiles) {
		this.mapProfiles = mapProfiles;
	}

	public int getLength() {
		int rs = 0;
		for (Profile profile : mapProfiles) {
			rs += profile.getNumOfBytes() + profile.getSpace();
		}
		return rs;
	}

	public static boolean isStartDate(Profile profile) {
		if (ProfileUserMapping.def_start_date.equals(profile.getColumnMapping())) {
			return true;
		}
		return false;
	}

	public static boolean isStartTime(Profile profile) {
		if (ProfileUserMapping.def_start_time.equals(profile.getColumnMapping())) {
			return true;
		}
		return false;
	}

	public static boolean isDuration(Profile profile) {
		if (ProfileUserMapping.def_duration.equals(profile.getColumnMapping())) {
			return true;
		}
		return false;
	}

	public SimpleDateFormat getDateFormat() {
		return dateFormat;
	}

	public void setDateFormat(SimpleDateFormat dateFormat) {
		this.dateFormat = dateFormat;
	}

	public SimpleDateFormat getTimeFormat() {
		return timeFormat;
	}

	public void setTimeFormat(SimpleDateFormat timeFormat) {
		this.timeFormat = timeFormat;
	}

	public SimpleDateFormat getDurationFormat() {
		return durationFormat;
	}

	public void setDurationFormat(SimpleDateFormat durationFormat) {
		this.durationFormat = durationFormat;
	}

}
